
use "$input/yu_ash_ready", clear

* use data after 1965
keep if year >= 1965


**********************
* Figure A1 Panel A
**********************

lgraph polar year howretainfe if elect_or_G, ytitle("Voter Polarization") xtitle("Year") legend(order(1 "Governor Selection" 2 "Non-Partisan Elections" 3 "Partisan Elections" 4 "Merit System"))
graph export "$output/figures/figA1_A.pdf", replace


**********************
* Figure A1 Panel B
**********************

lgraph polar_start year howretainfe if elect_or_G, ytitle("Voter Polarization") xtitle("Year") legend(order(1 "Governor Selection" 2 "Non-Partisan Elections" 3 "Partisan Elections" 4 "Merit System"))
graph export "$output/figures/figA1_B.pdf", replace


**********************
* Figure A2
**********************

lgraph cites_pos_m_log year howretainfe if elect_or_G, ytitle("Log Citations Per Opinion") xtitle("Year") legend(order(1 "Governor Selection" 2 "Non-Partisan Elections" 3 "Partisan Elections" 4 "Merit System"))
graph export "$output/figures/figA2.pdf", replace


**********************
* Figure A3 Panel A
**********************
binscatter cites_pos_m_log polar_start if rule_P , nquantiles(20) absorb(stateyear)  ytitle("Log Citations Per Opinion") xtitle("Voter Polarization at Judge Start Year")
graph export "$output/figures/figA3_A.pdf", replace

**********************
* Figure A3 Panel B
**********************
binscatter cites_pos_m_log polar_start if rule_P , nquantiles(20) absorb(stateyear)  controls(i.x_decade_start) ytitle("Log Citations Per Opinion") xtitle("Voter Polarization at Judge Start Year")
graph export "$output/figures/figA3_B.pdf", replace


**********************
* Figure A4
**********************
eststo clear

foreach s in AL AR CO FL GA HI IN KS KY LA MI MS NC NM NY OH OK SC TN TX WV WY {

eststo: qui reghdfe cites_pos_m_log   polar_start if rule_P & stateabb != "`s'" , absorb(stateyear  i.statefe#c.x_year_start x_decade_start) cluster(state year)

}

coefplot est*, keep(polar_start) ci(90) nolabels legend(off)
graph export "$output/figures/figA4.pdf", replace

